package com.wanmait.recruitment.service.impl;

import com.github.pagehelper.PageInfo;
import com.wanmait.recruitment.mapper.CityMapper;
import com.wanmait.recruitment.pojo.City;
import com.wanmait.recruitment.service.CityService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class CityServicelmpl implements CityService {

    @Resource
     private  CityMapper cityMapper;
    @Override
    public void insert(City object) {

    }

    @Override
    @CacheEvict(value = "cityCache",allEntries = true)
    public void delete(Integer id) {
        cityMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void delete(String ids) {

    }

    @Override
    public void update(City object) {

    }

    @Override
    public City findById(Integer id) {
        return cityMapper.findById(id);
    }

    @Override
    @Cacheable("cityCache")
    public List<City> findAll() {
        return cityMapper.selectHot();
    }
    @Override
    @Cacheable("cityCache")
    public List<City> selectAF() {
        return cityMapper.selectAF();
    }
    @Override
    @Cacheable("cityCache")
    public List<City> selectKN() {
        return cityMapper.selectKN();
    }
    @Override
    @Cacheable("cityCache")
    public List<City> selectOR() {
        return cityMapper.selectQR();
    }
    @Override
    @Cacheable("cityCache")
    public List<City> selectSV() {
        return cityMapper.selectSV();
    }
    @Override
    @Cacheable("cityCache")
    public List<City> selectWZ() {
        return cityMapper.selectWZ();
    }
    @Override
    @Cacheable("cityCache")
    public List<City> selectGJ() {
        return cityMapper.selectGJ();
    }
   @Override
    public  List<City>selectCityTop(){
        return  cityMapper.selectListTop();
    }

    @Override
    @Cacheable("cityCache")
    public List<City> selectByProvinceId(int provinceId) {
        return cityMapper.selectByProvinceId(provinceId);
    }

    @Override
    @Cacheable("cityCache")
    public List<City> selectList() {
        return cityMapper.selectList();
    }

    @Override
    public void updateHop(int id) {
        cityMapper.updateHop(id);
    }

    @Override
    public void updateHot(int id) {
        cityMapper.updateHot(id);
    }

    @Override
    public void updataCityName(City city) {
        cityMapper.updateByPrimaryKeySelective(city);
    }

    @Override
    public List<City> findAll(City object) {
        return null;
    }

    @Override
    public PageInfo<City> findPage(int pageNum, int pageSize) {
        return null;
    }


}
